<?php
namespace app\api\validate;

use think\Validate;

/**
 * Class CarmationValidate
 * @package app\api\validate
 * @author zhenHong~
 */
class CarmationValidate extends Validate{
    protected $rule = [
        'title' => ['require'],
        'content'=>['require'],
        'pic' => ['require'],
        'pic_name' => ['require'],
        'id' => ['require','number'],
    ];

    protected $message = [
        'title' => '标题必填',
        'content' => '问题内容必填',
        'pic'   => '请上传图片',
        'pic_name' => '缺少图片名',
        'id' => '问题id参数错误',
    ];

    protected $scene = [
        //添加图片
        'addPic' => ['pic','pic_name'],
        //添加问题
        'addMation' => ['title','content'],
        //编辑问题
        'editMation' => ['id','title','content'],
        //删除问题
        'deletMation' => ['id'],
        //问题详情
        'mationInfo' => ['id'],
    ];
}